import {Component} from 'react'
import A from './components/A'
import B from './components/B'

/* 
	状态在哪里，操作状态的方法就在哪里
*/
export default class App extends Component{
	state = {car:'奥迪A6'}
	render(){
		return (
			<div style={{backgroundColor:'gray',padding:'10px'}}>
				<h2>我是App组件</h2>
				<A car={this.state.car}/>
				<br/>
				<br/>
				<B x={this.changeCar}/>
			</div>
		)
	}
	changeCar = (name)=>{
		this.setState({car:name})
	}
}